<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:System="clr-namespace:System;assembly=mscorlib" 
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:toolkitdock="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    xmlns:splitButton="clr-namespace:Delay;assembly=SplitButton"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:layoutToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit"
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    xmlns:menu="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    mc:Ignorable="d"
    xmlns:local="clr-namespace:Rawr.UI"
    x:Class="Rawr.UI.GraphDisplay"
    d:DesignWidth="640" d:DesignHeight="680">

    <UserControl.Resources>
        <common:HierarchicalDataTemplate x:Key="FilterTemplate" ItemsSource="{Binding Filters}">
            <CheckBox Margin="0"
                IsTabStop="False"
                IsThreeState="True"
                IsChecked="{Binding Enabled, Mode=TwoWay}"
                Content="{Binding Name}"
                />
        </common:HierarchicalDataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" d:LayoutOverrides="Width, Height" Margin="1,1,1,1">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        
        <!-- Header -->
        <Rectangle x:Name="BarBackground" VerticalAlignment="Stretch" Margin="0,0,0,-1" Canvas.ZIndex="1" Grid.ColumnSpan="3">
            <Rectangle.Stroke>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Stroke>
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFDEDEDE" Offset="1"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>

        <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,4,0,4" Canvas.ZIndex="2" Grid.ColumnSpan="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <local:ChartPicker x:Name="ChartPicker1" HorizontalAlignment="Left" Grid.Column="0"/>
            <Rectangle Fill="#4C000000" Stroke="#F0000000" StrokeThickness="0" Margin="2" Width="1" Grid.Column="1"/>
            <TextBlock x:Name="LB_LiveFilter" Text="Find:" TextWrapping="Wrap" Margin="2,0" VerticalAlignment="Center" Grid.Column="2"/>
            <TextBox x:Name="TB_LiveFilter" HorizontalAlignment="Stretch" Grid.Column="3" Margin="2,0" KeyDown="TB_LiveFilter_KeyDown" ToolTipService.ToolTip="Type text to find in this list and press enter." Background="White"/>
            <Button x:Name="BT_AdvSearch" HorizontalAlignment="Right" Grid.Column="4"  Content="Adv. Search" Margin="2,0" Click="BT_AdvSearch_Click" ToolTipService.ToolTip="Opens an Advanced Search box which will display results in a special chart."/>
            <CheckBox x:Name="CK_UseRegex" Content="" Grid.Column="5" VerticalAlignment="Center" HorizontalAlignment="Right" ToolTipService.ToolTip="Checking this will use Regex on Advanced Searches" />
            <Rectangle Fill="#4C000000" Stroke="#F0000000" StrokeThickness="0" Margin="2" Width="1" Grid.Column="6"/>
            <TextBlock Text="Sort:" Margin="2,0" VerticalAlignment="Center" Grid.Column="7" />
            <ComboBox x:Name="SortCombo" Width="128" SelectionChanged="SortChanged" Margin="2,0" SelectedIndex="1" Grid.Column="8">
                <System:String>Alphabetical</System:String>
                <System:String>Overall</System:String>
            </ComboBox>
            <Rectangle Fill="#4C000000" Stroke="#F0000000" StrokeThickness="0" Margin="2" Width="1" Grid.Column="9"/>
            <local:ItemFilterPopup x:Name="FilterPopup" HorizontalAlignment="Left" Grid.Column="10"/>
            <splitButton:MenuButton Content="Export" x:Name="ExportMenu" HorizontalAlignment="Left" Margin="2,0" Padding="6,1,6,1" Grid.Column="11">
                <splitButton:MenuButton.ButtonMenuItemsSource>
                    <menu:MenuItem Header="Copy Data to Clipboard" Click="CopyCSVDataToClipboard"/>
                    <menu:MenuItem Header="Export to CSV..." Click="ExportToCSV"/>
                    <menu:MenuItem x:Name="MI_PawnExport" Header="Copy Pawn String to Clipboard" Click="ExportToPawn"/>
                    <menu:MenuItem Header="Export to Image... (NYI)"/>
                </splitButton:MenuButton.ButtonMenuItemsSource>
            </splitButton:MenuButton>
            <Button x:Name="ButtonExpand" Click="ButtonExpand_Click" ToolTipService.ToolTip="Click to Expand or Collapse the Filters frame" Content="Filters" Padding="8,1" Margin="2,0" Grid.Column="12" />
        </Grid>
        <local:ComparisonGraphLegend x:Name="CGL_Legend" Grid.Row="1" Grid.ColumnSpan="1"/>
        <!-- Body -->
        <!--IFSL-->
        <ScrollViewer x:Name="GraphScroll" Background="#FFFFFFFF" Grid.Row="2" Margin="0,-1,0,0" VerticalScrollBarVisibility="Auto"  Grid.ColumnSpan="1">
            <local:ComparisonGraph x:Name="ComparisonGraph" VerticalAlignment="Top" />
        <!--ENDIFSL-->
        <!--IFWPF
        <ScrollViewer x:Name="GraphScroll" Background="#FFFFFFFF" Grid.Row="2" Margin="0,-1,0,0" VerticalScrollBarVisibility="Auto"  Grid.ColumnSpan="1" BorderThickness="1">
            <ScrollViewer.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <LinearGradientBrush.RelativeTransform>
                        <TransformGroup>
                            <ScaleTransform CenterX="0.5" CenterY="0.5"/>
                            <SkewTransform CenterX="0.5" CenterY="0.5"/>
                            <RotateTransform CenterX="0.5" CenterY="0.5"/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </LinearGradientBrush.RelativeTransform>
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                </LinearGradientBrush>
            </ScrollViewer.BorderBrush>
            <local:ComparisonGraph x:Name="ComparisonGraph" VerticalAlignment="Top" BorderThickness="1">
                <local:ComparisonGraph.BorderBrush>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <LinearGradientBrush.RelativeTransform>
                            <TransformGroup>
                                <ScaleTransform CenterX="0.5" CenterY="0.5"/>
                                <SkewTransform CenterX="0.5" CenterY="0.5"/>
                                <RotateTransform CenterX="0.5" CenterY="0.5"/>
                                <TranslateTransform/>
                            </TransformGroup>
                        </LinearGradientBrush.RelativeTransform>
                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                        <GradientStop Color="#FF617584" Offset="1"/>
                        <GradientStop Color="#FF718597" Offset="0.375"/>
                    </LinearGradientBrush>
                </local:ComparisonGraph.BorderBrush>
            </local:ComparisonGraph>
        ENDIFWPF-->
        </ScrollViewer>
        <!--IFSL-->
        <sdk:GridSplitter x:Name="FilterSplitter" MouseLeftButtonUp="GridSplitter_MouseLeftButtonUp" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" ShowsPreview="True" HorizontalAlignment="Left" Visibility="Visible">
        <!--ENDIFSL-->
        <!--IFWPF
        <sdk:GridSplitter x:Name="FilterSplitter" MouseLeftButtonUp="GridSplitter_MouseLeftButtonUp" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" ShowsPreview="True" HorizontalAlignment="Left" Visibility="Visible" MinWidth="10">
        ENDIFWPF-->
            <sdk:GridSplitter.Background>
                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                    <GradientStop Color="White" Offset="0" />
                    <GradientStop Color="#FFDEDEDE" Offset="1" />
                </LinearGradientBrush>
            </sdk:GridSplitter.Background>
        </sdk:GridSplitter>
        <Grid Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Margin="10,0,0,0" Visibility="Visible">
            <layoutToolkit:Accordion x:Name="FilterAccordion" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" SelectionMode="OneOrMore" SelectionSequence="Simultaneous">
                <layoutToolkit:Accordion.BorderBrush>
                    <LinearGradientBrush EndPoint="1,0.4" StartPoint="0,0.4">
                        <GradientStop Color="#FFA3AEB9" Offset="0" />
                        <GradientStop Color="#FF617584" Offset="1" />
                        <GradientStop Color="#FF718597" Offset="0.333" />
                    </LinearGradientBrush>
                </layoutToolkit:Accordion.BorderBrush>
                <layoutToolkit:AccordionItem x:Name="AI_Source" Header="Filters by Source" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsSelected="True">
                    <Grid Margin="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Button Content="Reset" Grid.Column="1" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFilters_Reset" Click="BT_SourceFilters_Reset_Click" />
                        <Button Content="UnCheck All" Grid.Column="3" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFilters_UnCheckAll" Click="BT_SourceFilters_UnCheckAll_Click" />
                        <Button Content="Edit" Grid.Column="4" Margin="1" Padding="8,1" Click="ShowItemFilters" Name="BT_EditSourceFilters" VerticalAlignment="Top" />
                        <TextBlock Text="Note: Some items may have multiple sources" VerticalAlignment="Center" TextWrapping="Wrap" Margin="2" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="5" />
                        <controls:TreeView x:Name="FilterTree" BorderThickness="0" Background="Transparent" Margin="0" Padding="0" ItemTemplate="{StaticResource FilterTemplate}" Grid.ColumnSpan="5" Grid.Row="2">
                            <controls:TreeView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <!--IFSL-->
                                    <StackPanel Orientation="Vertical" Margin="-6,-8,-10,-8"/>
                                    <!--ENDIFSL-->
                                    <!--IFWPF
                                    <StackPanel Orientation="Vertical" Margin="0"/>
                                    ENDIFWPF-->
                                </ItemsPanelTemplate>
                            </controls:TreeView.ItemsPanel>
                        </controls:TreeView>
                    </Grid>
                </layoutToolkit:AccordionItem>
                <layoutToolkit:AccordionItem x:Name="AI_Type" Header="Filters by Item Type"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" IsSelected="False">
                    <Grid Margin="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock Text="Make your changes then click Apply" VerticalAlignment="Center" TextWrapping="Wrap" Margin="2" />
                        <Button Content="Apply" Grid.Column="1" Margin="1" Padding="8,3" Click="CheckBox_Click" Name="BT_ApplyTypeFilter" VerticalAlignment="Top" />
                        <ScrollViewer x:Name="SV_Type" Grid.ColumnSpan="2" Grid.Row="1">
                            <toolkit:WrapPanel>
                                <Grid Margin="2">
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Rectangle Stroke="DarkGray" Grid.RowSpan="6" Margin="0,8,0,0" StrokeLineJoin="Bevel" />
                                    <sdk:Label Content="1H Weapons" Background="White" Margin="4,0" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Left" Padding="2,0" />
                                    <CheckBox Content="Fist Weapons" Margin="4,0" Name="CheckBoxFistWeapon" Tag="FistWeapon" Grid.Row="1" />
                                    <CheckBox Content="Daggers" Margin="4,0" Name="CheckBoxDagger" Tag="Dagger" Grid.Row="2" />
                                    <CheckBox Content="1H Axe" Margin="4,0" Name="CheckBoxOneHandedAxe" Tag="OneHandAxe" Grid.Row="3" />
                                    <CheckBox Content="1H Mace" Margin="4,0" Name="CheckBoxOneHandedMace" Tag="OneHandMace" Grid.Row="4" />
                                    <CheckBox Content="1H Sword" Margin="4,0" Name="CheckBoxOneHandedSword" Tag="OneHandSword" Grid.Row="5" />
                                </Grid>
                                <Grid Margin="2">
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Rectangle Stroke="DarkGray" Grid.RowSpan="6" Margin="0,8,0,0" StrokeLineJoin="Bevel" />
                                    <sdk:Label Content="2H Weapons" Background="White" Margin="4,0" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Left" Padding="2,0" />
                                    <CheckBox Content="Staff" Margin="4,0" Name="CheckBoxStaff" Tag="Staff" Grid.Row="1" />
                                    <CheckBox Content="Polearm" Margin="4,0" Name="CheckBoxPolearm" Tag="Polearm" Grid.Row="2" />
                                    <CheckBox Content="2H Axe" Margin="4,0" Name="CheckBoxTwoHandedAxe" Tag="TwoHandAxe" Grid.Row="3" />
                                    <CheckBox Content="2H Mace" Margin="4,0" Name="CheckBoxTwoHandedMace" Tag="TwoHandMace" Grid.Row="4" />
                                    <CheckBox Content="2H Sword" Margin="4,0" Name="CheckBoxTwoHandedSword" Tag="TwoHandSword" Grid.Row="5" />
                                </Grid>
                                <Grid Margin="2">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Rectangle Stroke="DarkGray" Grid.RowSpan="6" Margin="0,8,0,0" StrokeLineJoin="Bevel" />
                                    <sdk:Label Content="Armor" Background="White" Margin="4,0" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Left" Padding="2,0" />
                                    <CheckBox Content="Cloth" Margin="4,0" Name="CheckBoxCloth" Tag="Cloth" Grid.Row="1" />
                                    <CheckBox Content="Leather" Margin="4,0" Name="CheckBoxLeather" Tag="Leather" Grid.Row="2" />
                                    <CheckBox Content="Mail" Margin="4,0" Name="CheckBoxMail" Tag="Mail" Grid.Row="3" />
                                    <CheckBox Content="Plate" Margin="4,0" Name="CheckBoxPlate" Tag="Plate" Grid.Row="4" />
                                </Grid>
                                <Grid Margin="2">
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Rectangle Stroke="DarkGray" Grid.RowSpan="7" Margin="0,8,0,0" StrokeLineJoin="Bevel" />
                                    <sdk:Label Content="Ranged Weapons" Background="White" Margin="4,0" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Left" Padding="2,0" />
                                    <CheckBox Content="Bow" Margin="4,0" Name="CheckBoxBow" Tag="Bow" Grid.Row="1" />
                                    <CheckBox Content="Crossbow" Margin="4,0" Name="CheckBoxCrossBow" Tag="Crossbow" Grid.Row="2" />
                                    <CheckBox Content="Gun" Margin="4,0" Name="CheckBoxGun" Tag="Gun" Grid.Row="3" />
                                    <CheckBox Content="Wand" Margin="4,0" Name="CheckBoxWand" Tag="Wand" Grid.Row="4" />
                                    <CheckBox Content="Thrown" Margin="4,0" Name="CheckBoxThrown" Tag="Thrown" Grid.Row="5" />
                                    <CheckBox Content="Relic" Margin="4,0" Name="CheckBoxRelic" Tag="Relic" Grid.Row="6" />
                                </Grid>
                                <Grid Margin="2">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Rectangle Stroke="DarkGray" Grid.RowSpan="6" Margin="0,8,0,0" StrokeLineJoin="Bevel" />
                                    <sdk:Label Content="Off-Hand" Background="White" Margin="4,0" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Left" Padding="2,0" />
                                    <CheckBox Content="Shield" Margin="4,0" Name="CheckBoxShield" Tag="Shield" Grid.Row="1" />
                                    <CheckBox Content="Misc" Margin="4,0" Name="CheckBoxMisc" Tag="None" Grid.Row="2" />
                                </Grid>
                            </toolkit:WrapPanel>
                        </ScrollViewer>
                    </Grid>
                </layoutToolkit:AccordionItem>
                <layoutToolkit:AccordionItem x:Name="AI_Prof" Header="Filters by Profession" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsSelected="False" ToolTipService.ToolTip="Items that are limited to certain Professions. This doesn't apply to gems.">
                    <ScrollViewer x:Name="SV_Prof">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <TextBlock Text="You can use the Character's professions or check the groupings you want to see. These only limit BoP items, not BoE." VerticalAlignment="Center" TextWrapping="Wrap" Margin="2" />

                            <Grid Grid.Row="1" Grid.ColumnSpan="3">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Reset" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersProf_Reset" Click="BT_SourceFiltersProf_Reset_Click" />
                                <Button Content="UnCheck All" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersProf_UnCheckAll" Click="BT_SourceFiltersProf_UnCheckAll_Click" />
                            </Grid>

                            <RadioButton GroupName="FilterProfs" Grid.Row="2" Grid.ColumnSpan="2" x:Name="CK_FiltersProf_UseCharProfs" Margin="4,0" Content="Use Char's Professions" IsChecked="True" />
                            <RadioButton GroupName="FilterProfs" Grid.Row="3" Grid.ColumnSpan="2" x:Name="CK_FiltersProf_UseChecks" Margin="4,0" Content="Custom Selection" />
                            
                            <StackPanel Grid.Row="4" Grid.ColumnSpan="2">
                                <CheckBox x:Name="CK_FiltersProf_Alch" Margin="4,0" Content="Alchemy" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Blck" Margin="4,0" Content="Blacksmithing" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Ench" Margin="4,0" Content="Enchanting" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Engr" Margin="4,0" Content="Engineering" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Herb" Margin="4,0" Content="Herbalism" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Insc" Margin="4,0" Content="Inscription" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Jewl" Margin="4,0" Content="Jewelcrafting" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Lthr" Margin="4,0" Content="Leatherworking" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Mine" Margin="4,0" Content="Mining" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Skin" Margin="4,0" Content="Skinning" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_FiltersProf_Tail" Margin="4,0" Content="Tailoring" IsEnabled="{Binding ElementName=CK_FiltersProf_UseChecks, Path=IsChecked}" />
                            </StackPanel>
                        </Grid>
                    </ScrollViewer>
                </layoutToolkit:AccordionItem>
                <layoutToolkit:AccordionItem x:Name="AI_Bind" Header="Filters by Bind Type" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsSelected="False" ToolTipService.ToolTip="Items that Bind under certain conditions.">
                    <ScrollViewer x:Name="SV_Bind">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Row="0" Grid.ColumnSpan="3" Text="Check the groupings you want to see." TextWrapping="Wrap"/>

                            <Grid Grid.Row="1" Grid.ColumnSpan="3">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Reset" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersBind_Reset" Click="BT_SourceFiltersBind_Reset_Click" />
                                <Button Content="UnCheck All" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersBind_UnCheckAll" Click="BT_SourceFiltersBind_UnCheckAll_Click" />
                            </Grid>

                            <StackPanel Grid.Row="3" Grid.ColumnSpan="3">
                                <CheckBox x:Name="CK_Bind_0" Margin="4,0" Content="Doesn't Bind" />
                                <CheckBox x:Name="CK_Bind_1" Margin="4,0" Content="Binds to Account" />
                                <CheckBox x:Name="CK_Bind_2" Margin="4,0" Content="Binds on Use" />
                                <CheckBox x:Name="CK_Bind_3" Margin="4,0" Content="Binds on Equip" />
                                <CheckBox x:Name="CK_Bind_4" Margin="4,0" Content="Binds on Pickup" />
                            </StackPanel>
                        </Grid>
                    </ScrollViewer>
                </layoutToolkit:AccordionItem>
                <layoutToolkit:AccordionItem x:Name="AI_Drop" Header="Filters by Drop Rate" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsSelected="False">
                    <ScrollViewer x:Name="SV_Drop">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Row="0" Grid.ColumnSpan="3" Text="You can select the groupings you want to see OR use the slider for a custom view." TextWrapping="Wrap"/>

                            <Grid Grid.Row="1" Grid.ColumnSpan="3">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Reset" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersDrop_Reset" Click="BT_SourceFiltersDrop_Reset_Click" />
                                <Button Content="UnCheck All" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersDrop_UnCheckAll" Click="BT_SourceFiltersDrop_UnCheckAll_Click" />
                            </Grid>

                            <RadioButton Grid.ColumnSpan="3" x:Name="RB_Drop_Checks" Margin="4,0" Grid.Row="2" Content="By Checking Groups" IsChecked="True" GroupName="Filters_Drop"/>
                            <StackPanel Grid.Row="3" Grid.ColumnSpan="3">
                                <CheckBox x:Name="CK_Drop_00" Margin="4,0" Content="&gt;=00% &lt;01%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_01" Margin="4,0" Content="&gt;=01% &lt;03%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_02" Margin="4,0" Content="&gt;=03% &lt;05%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_03" Margin="4,0" Content="&gt;=05% &lt;10%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_04" Margin="4,0" Content="&gt;=10% &lt;15%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_05" Margin="4,0" Content="&gt;=15% &lt;20%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_06" Margin="4,0" Content="&gt;=20% &lt;25%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_07" Margin="4,0" Content="&gt;=25% &lt;30%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_08" Margin="4,0" Content="&gt;=30% &lt;40%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_09" Margin="4,0" Content="&gt;=40% &lt;50%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_Drop_10" Margin="4,0" Content="&gt;=50% &lt;=100%" IsEnabled="{Binding ElementName=RB_Drop_Checks, Path=IsChecked}" />
                            </StackPanel>

                            <RadioButton Grid.ColumnSpan="3" x:Name="RB_Drop_Sliders" Margin="4,0" Grid.Row="4" Content="By Custom Slider" IsChecked="True" GroupName="Filters_Drop"/>
                            <local:RangeSlider x:Name="RS_Drop" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" Margin="2" IsEnabled="{Binding ElementName=RB_Drop_Sliders, Path=IsChecked}"
                                                Minimum="0" LowerValue="0" UpperValue="100" Maximum="100" ShowTicks="True" ShowLabels="True" IsHorizontal="True" TickFrequency="10" />
                            <inputToolkit:NumericUpDown Grid.Row="5" Grid.Column="0" IsEnabled="{Binding ElementName=RB_Drop_Sliders, Path=IsChecked}" Value="{Binding ElementName=RS_Drop, Path=LowerValue, Mode=TwoWay}" Minimum="0"    Maximum="{Binding ElementName=RS_Drop, Path=UpperValue}" Name="NUD_Drop_Min" MinWidth="50" Margin="2" />
                            <inputToolkit:NumericUpDown Grid.Row="5" Grid.Column="2" IsEnabled="{Binding ElementName=RB_Drop_Sliders, Path=IsChecked}" Value="{Binding ElementName=RS_Drop, Path=UpperValue, Mode=TwoWay}" Minimum="{Binding ElementName=RS_Drop, Path=LowerValue}" Maximum="100" Name="NUD_Drop_Max" MinWidth="50" Margin="2" />
                        </Grid>
                    </ScrollViewer>
                </layoutToolkit:AccordionItem>
                <layoutToolkit:AccordionItem x:Name="AI_iLevel" Header="Filters by Item Level" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsSelected="False">
                    <ScrollViewer x:Name="SV_iLevel">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Row="0" Grid.ColumnSpan="3" Text="You can select the groupings you want to see OR use the slider for a custom view." TextWrapping="Wrap"/>

                            <Grid Grid.Row="1" Grid.ColumnSpan="3">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Reset" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersIlvl_Reset" Click="BT_SourceFiltersILvl_Reset_Click" />
                                <Button Content="UnCheck All" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" Margin="1" Padding="8,1" Name="BT_SourceFiltersIlvl_UnCheckAll" Click="BT_SourceFiltersILvl_UnCheckAll_Click" />
                                <!--<Button Content="Edit" Grid.Row="1" Grid.Column="3" Margin="1" Padding="8,1" Click="ShowItemFilters" Name="BT_EditSourceFiltersIlvl" VerticalAlignment="Top" Visibility="Collapsed"/>-->
                            </Grid>

                            <RadioButton Grid.ColumnSpan="3" x:Name="RB_iLvl_Checks" Margin="4,0" Grid.Row="2" Content="By Checking Groups" IsChecked="True" GroupName="Filters_iLvL"/>
                            <StackPanel Grid.Row="3" Grid.ColumnSpan="3">
                                <CheckBox x:Name="CK_iLvl_0" Margin="4,0" Content="000-001 (Heirloom)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_1" Margin="4,0" Content="002-199 (Tier 01-06)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_2" Margin="4,0" Content="200-284 (Tier 07-10)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_3" Margin="4,0" Content="285-333 (Cata Dungeons)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_4" Margin="4,0" Content="334-352 (Cata Heroics)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_5" Margin="4,0" Content="353-358 (Rise of Zandalar)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_6" Margin="4,0" Content="359-364 (Tier 11.0)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_7" Margin="4,0" Content="365-371 (Molten Front)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_8" Margin="4,0" Content="372-377 (Tier 11.5)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_9" Margin="4,0" Content="378-383 (Tier 12.0/Hour of Twilight)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_10" Margin="4,0" Content="384-390 (Tier 13.LFR)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_11" Margin="4,0" Content="391-396 (Tier 12.5)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_12" Margin="4,0" Content="397-409 (Tier 13.0)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                                <CheckBox x:Name="CK_iLvl_13" Margin="4,0" Content="410-416 (Tier 13.5)" IsEnabled="{Binding ElementName=RB_iLvl_Checks, Path=IsChecked}" />
                            </StackPanel>

                            <RadioButton Grid.ColumnSpan="3" x:Name="RB_iLvl_Sliders" Margin="4,0" Grid.Row="4" Content="By Custom Slider" IsChecked="True" GroupName="Filters_iLvL"/>
                            <local:RangeSlider x:Name="RS_iLvl" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" Margin="2" IsEnabled="{Binding ElementName=RB_iLvl_Sliders, Path=IsChecked}"
                                                Minimum="0" LowerValue="285" UpperValue="397" Maximum="500" d:TickFrequency="50" ShowTicks="True" ShowLabels="True" IsHorizontal="True" TickFrequency="50" />
                            <inputToolkit:NumericUpDown Grid.Row="5" Grid.Column="0" IsEnabled="{Binding ElementName=RB_iLvl_Sliders, Path=IsChecked}" Value="{Binding ElementName=RS_iLvl, Path=LowerValue, Mode=TwoWay}" Minimum="0"    Maximum="{Binding ElementName=RS_iLvl, Path=UpperValue}" Name="NUD_iLvl_Min" MinWidth="50" Margin="2" />
                            <inputToolkit:NumericUpDown Grid.Row="5" Grid.Column="2" IsEnabled="{Binding ElementName=RB_iLvl_Sliders, Path=IsChecked}" Value="{Binding ElementName=RS_iLvl, Path=UpperValue, Mode=TwoWay}" Minimum="{Binding ElementName=RS_iLvl, Path=LowerValue}" Maximum="500" Name="NUD_iLvl_Max" MinWidth="50" Margin="2" />
                        </Grid>
                    </ScrollViewer>
                </layoutToolkit:AccordionItem>
                <layoutToolkit:AccordionItem x:Name="AI_Gems" Header="Gem Filters" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsSelected="False" IsEnabled="False" Foreground="DarkGray">
                    <ScrollViewer x:Name="SV_Gems">
                        <StackPanel>
                            <CheckBox Content="Jewelcrafter BoP" Margin="4,0" />
                            <CheckBox Content="Crafted (Non-BoP)" Margin="4,0" />
                            <CheckBox Content="PvP" Margin="4,0" />
                            <CheckBox Content="World Drop" Margin="4,0" />
                            <CheckBox Content="Quest Rewards" Margin="4,0" />
                            <CheckBox Content="Unknown/Needs Refreshed" Margin="4,0" />
                        </StackPanel>
                    </ScrollViewer>
                </layoutToolkit:AccordionItem>
            </layoutToolkit:Accordion>
        </Grid>
    </Grid>
</UserControl>
